#!/usr/bin/env python
# -*- coding: utf-8 -*-


class DeviceMgr:
    def __init__(self, app, session):
        self.app = app
        self.session = session
        self.app.logger.warning(f'{self.__class__}: method __init__() is empty')


    def destroy(self):
        self.session = None
        self.app = None
        


    def __del__(self):
        self.destroy()


    def get_devices(self):
        return {
            "code": 200,
            "content": {
                "devices": [
                    {
                        "name": "mock ohos设备", 
                        "sn": "111111", 
                        "type": "手机", 
                        "ip": ["192.168.1.100"], 
                        "proxy": "127.0.0.1",
                        "status": "online",
                    },
                    {
                        "name": "mock hos设备", 
                        "sn": "222222", 
                        "type": "平板", 
                        "ip": "192.168.1.101", 
                        "proxy": "172.16.1.1",
                        "status": "offline",
                    },
                    {
                        "name": "mock khos设备", 
                        "sn": "333333", 
                        "type": "手机", 
                        "ip": "192.168.1.102", 
                        "proxy": "192.168.1.1",
                        "status": "online",
                    },
                ]
            },
        }

    
    def open_device(self, sn: str):
        return { "code": 200, "content": {}, }